]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panel: fix up calendar-vs-menu handling on clock
authorDan Winship <danw@gnome.org>
Fri, 19 Nov 2010 18:00:59 +0000 (13:00 -0500)
committerDan Winship <danw@gnome.org>
Tue, 21 Dec 2010 22:10:36 +0000 (17:10 -0500)
Give the clock's right-click menu its own PopupMenuManager so that if
you drop down another menu and then mouseover the clock it doesn't
pop up the right-click menu.

https://bugzilla.gnome.org/show_bug.cgi?id=634755

js/ui/panel.js

index fc4614dc5fa75f7e7d544e190024db8be7391ea4..e797a36f9751003eb03fda617d0f6397e02d9c2f 100644 (file)
@@ -512,11 +512,14 @@ ClockButton.prototype = {
 
     _onButtonPress: function(actor, event) {
         let button = event.get_button();
-        if (button == 3 &&
-            (!this._calendarPopup || !this._calendarPopup.isOpen))
+        let menuShowing = this.menu.isOpen;
+        let calendarShowing = this._calendarPopup && this._calendarPopup.isOpen;
+
+        if (menuShowing || (button == 3 && !calendarShowing))
             this.menu.toggle();
         else
             this._toggleCalendar();
+        return true;
     },
 
     closeCalendar: function() {
@@ -525,15 +528,12 @@ ClockButton.prototype = {
 
         this._calendarPopup.hide();
 
-        this.menu.isOpen = false;
         this.actor.remove_style_pseudo_class('pressed');
     },
 
     openCalendar: function() {
         this._calendarPopup.show();
 
-        // simulate an open menu, so it won't appear beneath the calendar
-        this.menu.isOpen = true;
         this.actor.add_style_pseudo_class('pressed');
     },
 
@@ -803,7 +803,8 @@ Panel.prototype = {
         this._clockButton = new ClockButton();
         this._centerBox.add(this._clockButton.actor, { y_fill: true });
 
-        this._menus.addMenu(this._clockButton.menu);
+        let clockMenuManager = new PopupMenu.PopupMenuManager(this);
+        clockMenuManager.addMenu(this._clockButton.menu);
 
         /* right */